@page
@{ Layout = "_Layout"; }

<el-form :model="form" ref="form" v-if="form" size="mini" label-width="90px">
    <el-row>
        <el-col :span="24">
            <el-card>
                <div slot="header" class="clearfix">
                    <span>{{ id>0 ? '修改' : '新增' }}竞赛</span>
                    <el-button style="float: right;padding:3px 0;" type="text" v-on:click="utils.closeLayerSelf"><i class="el-icon-close"></i></el-button>
                </div>
                <div>
                    <el-scrollbar class="scrollbar" :style="{ height: ($(window).innerHeight()-180) + 'px' }">
                        <div style="margin-right:18px;">
                            <el-form-item label="竞赛名称" prop="name" :rules="{ required: true, message: '请输入名称' }">
                                <el-input v-model.trim="form.name" placeholder="请输入名称"></el-input>
                            </el-form-item>
                            <el-form-item label="规则" prop="ruleType">
                                <el-select ref="ruleType" v-model="form.ruleType" placeholder="请选择规则">
                                    <el-option v-for="rule in ruleList"
                                               :key="rule.value"
                                               :label="rule.label"
                                               :value="rule.value">
                                    </el-option>
                                </el-select>
                                <div class="tips">
                                    <el-tooltip placement="top">
                                        <div slot="content">
                                            1v1 淘汰赛<br />
                                            每场竞赛人数必须是[2, 4, 8, 16, 32, 64, 128, 256, 512]其中一组数量<br />
                                            两人一组，每组淘汰一人，胜者晋级下一轮，直到决赛<br />
                                            率先答对10题且用时最少者胜。
                                        </div>
                                        <i class="el-icon-info"></i>
                                    </el-tooltip>
                                </div>
                            </el-form-item>
                            <el-form-item label="竞赛时间" prop="pkBeginDateTime" :rules="{ required: true, message: '请选择开始时间' }">
                                <el-date-picker v-model="form.pkBeginDateTime"
                                                type="datetime"
                                                placeholder="开始时间"
                                                value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                            <el-form-item prop="pkEndDateTime" :rules="{ required: true, message: '请选择截止时间' }">
                                <el-date-picker v-model="form.pkEndDateTime"
                                                type="datetime"
                                                placeholder="截止时间"
                                                value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                            <el-form-item label="参赛者" prop="userGroupId" :rules="{ required: true, message: '请选择用户组' }">
                                <el-select ref="selectUserGroup" :disabled="id>0" v-model="form.userGroupId" filterable placeholder="请选择用户组" clearable style="width:100%">
                                    <el-option v-for="userGroup in userGroupList"
                                               :key="userGroup.id"
                                               :label="userGroup.groupName"
                                               :value="userGroup.id">
                                    </el-option>
                                </el-select>
                                <div class="tips">根据选择的用户组匹配需要参加竞赛的用户，多个组为并集。</div>
                            </el-form-item>
                            <el-form-item label="竞赛内容" prop="tmGroupIds" :rules="{ required: true, message: '请选择题目组' }">
                                <el-select ref="selectTmGroup" :disabled="id>0" v-model="form.tmGroupIds" filterable multiple placeholder="全部题目组" style="width:100%">
                                    <el-option v-for="tmGroup in tmGroupList"
                                               :key="tmGroup.id"
                                               :label="tmGroup.groupName"
                                               :value="tmGroup.id">
                                    </el-option>
                                </el-select>
                                <div class="tips">从题目组包含的题目范围内抽题，多个题目组是并集关系。默认从全部题库抽题。仅抽取客观题</div>
                            </el-form-item>
                        </div>
                    </el-scrollbar>
                </div>
            </el-card>
        </el-col>
    </el-row>
</el-form>
<el-row align="center" style="margin-top:18px;">
    <el-col :span="24" align="center">
        <el-button icon="el-icon-check" :size="euiSize" type="primary" v-on:click="btnSubmitClick">确 定</el-button>
        <el-button :size="euiSize" icon="el-icon-close"  v-on:click="utils.closeLayerSelf">取 消</el-button>
    </el-col>
</el-row>
@section Scripts{
    <script src="/sitefiles/assets/js/admin/exam/examPkEdit.js" type="text/javascript"></script>
}
